Skip to content

Commit

Permalink
feat(cactus-plugin-ledger-connector-ethereum): support London fork ga…
Browse files Browse the repository at this point in the history
…s prices

- Add legacy and EIP1559 gas configuration options to transaction requests.
- Legacy gas configuration is updated to EIP1559 using the same logic as web3 libraries.
- Update the tests to work with new API.
- Added test suite to test new features - `geth-transact-and-gas-fees.test.ts`

Depends on: #2581

Signed-off-by: Michal Bajer <[email protected]>
  • Loading branch information
outSH authored and petermetz committed Oct 2, 2023
1 parent d2c88c3 commit 80a89dd
Show file tree
Hide file tree
Showing 15 changed files with 908 additions and 193 deletions.
10 changes: 4 additions & 6 deletions packages/cactus-plugin-ledger-connector-ethereum/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@
"sanitize-html": "2.7.0",
"socket.io-client": "4.5.4",
"typescript-optional": "2.0.1",
"web3": "4.0.3",
"web3-eth-contract": "4.0.3",
"web3-utils": "4.0.3"
"web3": "4.1.2",
"web3-eth": "4.2.0",
"web3-eth-contract": "4.1.0"
},
"devDependencies": {
"@hyperledger/cactus-plugin-keychain-memory": "2.0.0-alpha.2",
Expand All @@ -86,9 +86,7 @@
"@types/minimist": "1.2.2",
"@types/sanitize-html": "2.6.2",
"chalk": "4.1.2",
"socket.io": "4.5.4",
"web3-eth": "4.0.3",
"web3-eth-accounts": "4.0.3"
"socket.io": "4.5.4"
},
"engines": {
"node": ">=10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,59 @@
}
}
},
"GasTransactionConfigLegacy": {
"type": "object",
"description": "Transaction gas settings in networks before EIP-1559 (London fork).",
"required": [],
"properties": {
"gas": {
"type": "string",
"description": "A maximum amount of gas a user is willing to provide for the execution of the transaction. (gasLimit)"
},
"gasPrice": {
"type": "string",
"description": "A price (in Wei) a user is willing to pay for each unit of gas used during the execution of the transaction. In EIP-1559 (London fork) networks, it will be set as both maxFeePerGas and maxPriorityFeePerGas."
}
}
},
"GasTransactionConfigEIP1559": {
"type": "object",
"description": "Transaction gas settings in networks after EIP-1559 (London fork).",
"required": [],
"properties": {
"gasLimit": {
"type": "string",
"description": "A maximum amount of gas a user is willing to provide for the execution of the transaction.",
"nullable": false
},
"maxFeePerGas": {
"type": "string",
"description": "A maximum fee (including the base fee and the tip) a user is willing to pay per unit of gas.",
"nullable": false
},
"maxPriorityFeePerGas": {
"type": "string",
"description": "A maximum tip amount a user is willing to pay per unit of gas.",
"nullable": false
}
}
},
"GasTransactionConfig": {
"type": "object",
"description": "Transaction gas settings.",
"required": [],
"oneOf": [
{
"$ref": "#/components/schemas/GasTransactionConfigLegacy"
},
{
"$ref": "#/components/schemas/GasTransactionConfigEIP1559"
}
]
},
"EthereumTransactionConfig": {
"type": "object",
"required": [],
"additionalProperties": true,
"properties": {
"rawTransaction": {
"type": "string",
Expand All @@ -225,17 +274,15 @@
"value": {
"type": "string"
},
"gas": {
"type": "string"
},
"gasPrice": {
"type": "string"
},
"nonce": {
"type": "string"
},
"data": {
"type": "string"
},
"gasConfig": {
"$ref": "#/components/schemas/GasTransactionConfig",
"nullable": false
}
}
},
Expand Down Expand Up @@ -450,12 +497,8 @@
"maxLength": 100,
"nullable": false
},
"gas": {
"type": "number",
"nullable": false
},
"gasPrice": {
"type": "number",
"gasConfig": {
"$ref": "#/components/schemas/GasTransactionConfig",
"nullable": false
},
"nonce": {
Expand Down Expand Up @@ -504,12 +547,8 @@
"$ref": "#/components/schemas/Web3SigningCredential",
"nullable": false
},
"gas": {
"type": "number",
"nullable": false
},
"gasPrice": {
"type": "string",
"gasConfig": {
"$ref": "#/components/schemas/GasTransactionConfig",
"nullable": false
},
"timeoutMs": {
Expand Down Expand Up @@ -574,11 +613,9 @@
"value": {
"type": "string"
},
"gas": {
"type": "string"
},
"gasPrice": {
"type": "string"
"gasConfig": {
"$ref": "#/components/schemas/GasTransactionConfig",
"nullable": false
},
"nonce": {
"type": "string"
Expand Down Expand Up @@ -640,11 +677,9 @@
"value": {
"type": "string"
},
"gas": {
"type": "string"
},
"gasPrice": {
"type": "string"
"gasConfig": {
"$ref": "#/components/schemas/GasTransactionConfig",
"nullable": false
},
"nonce": {
"type": "string"
Expand Down Expand Up @@ -799,12 +834,7 @@
},
"Web3BlockHeader": {
"type": "object",
"required": [
"sha3Uncles",
"transactionRoot",
"gasLimit",
"gasUsed"
],
"required": ["sha3Uncles", "transactionRoot", "gasLimit", "gasUsed"],
"properties": {
"number": {
"type": "string"
Expand Down Expand Up @@ -1145,7 +1175,7 @@
}
},
"operationId": "invokeContractV1",
"summary": "Invokes a contract on a besu ledger",
"summary": "Invokes a contract on an ethereum ledger",
"parameters": [],
"requestBody": {
"content": {
Expand Down Expand Up @@ -1179,7 +1209,7 @@
}
},
"operationId": "invokeContractV1NoKeychain",
"summary": "Invokes a contract on a besu ledger",
"summary": "Invokes a contract on an ethereum ledger",
"parameters": [],
"requestBody": {
"content": {
Expand Down
Loading

0 comments on commit 80a89dd

Please sign in to comment.