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: hyperledger-cacti#2581

Signed-off-by: Michal Bajer <[email protected]>
  • Loading branch information
outSH committed Aug 21, 2023
1 parent 87cd1e0 commit 9a7dc2c
Show file tree
Hide file tree
Showing 11 changed files with 637 additions and 136 deletions.
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 9a7dc2c

Please sign in to comment.