Skip to content

Commit c6e76fe

Browse files
committed
Changing max gas for revocation list transaction
1 parent 9c96d40 commit c6e76fe

3 files changed

Lines changed: 31 additions & 2 deletions

File tree

aries_cloudagent/anoncreds/default/did_besu/registry.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ def __init__(self):
148148
self.VALIDATOR_CONTROL_ADDRESS = None
149149
self.ROLE_CONTROL_ADDRESS = None
150150
self.REVOCATION_ADDRESS = None
151+
self.REVOCATION_LIST_GAS_LIMIT = "0x1fffffffffffff"
151152

152153
@property
153154
def supported_identifiers_regex(self) -> Pattern:
@@ -168,6 +169,10 @@ async def setup(self, context: InjectionContext):
168169
self.REVOCATION_ADDRESS = context.settings.get(
169170
"ledger.revocation_contract_address"
170171
)
172+
if context.settings.get("ledger.revocation_list_gas_limit"):
173+
self.REVOCATION_LIST_GAS_LIMIT = context.settings.get(
174+
"ledger.revocation_list_gas_limit"
175+
)
171176

172177
self.web3 = Web3(Web3.HTTPProvider(self.HTTP_PROVIDER))
173178
self.web3.middleware_onion.inject(geth_poa_middleware, layer=0)
@@ -276,7 +281,13 @@ async def register_revocation(
276281
Chain_id = self.web3.eth.chain_id
277282
nonce = self.web3.eth.get_transaction_count(self.ACCOUNT)
278283
call_function = contract.functions.createRevocation(rev_json).build_transaction(
279-
{"chainId": Chain_id, "from": self.ACCOUNT, "nonce": nonce, "gas": 3000000}
284+
{
285+
"chainId": Chain_id,
286+
"from": self.ACCOUNT,
287+
"nonce": nonce,
288+
"gas": 3000000,
289+
"gasPrice": self.web3.eth.gas_price,
290+
}
280291
)
281292

282293
tx_receipt = await self.send_transaction_tx(call_function)
@@ -620,6 +631,7 @@ async def register_revocation_registry_definition(
620631
"from": self.ACCOUNT,
621632
"nonce": nonce,
622633
"gas": 3000000,
634+
"gasPrice": self.web3.eth.gas_price,
623635
}
624636
)
625637

@@ -786,7 +798,8 @@ async def _revoc_reg_entry_with_fix(
786798
"chainId": Chain_id,
787799
"from": self.ACCOUNT,
788800
"nonce": nonce,
789-
"gas": "0x1fffffffffffff",
801+
"gas": int(self.REVOCATION_LIST_GAS_LIMIT),
802+
"gasPrice": self.web3.eth.gas_price,
790803
}
791804
)
792805

aries_cloudagent/config/argparse.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,17 @@ def add_arguments(self, parser: ArgumentParser):
876876
"starts with 0x, this prefix is added."
877877
),
878878
)
879+
parser.add_argument(
880+
"--revocation-list-gas-limit",
881+
type=str,
882+
metavar="<account>",
883+
required=False,
884+
dest="revocation_list_gas_limit",
885+
env_var="ACAPY_REVOCATION_LIST_GAS_LIMIT",
886+
help=(
887+
"Specifies de gas limit for the update of revocation list transaction."
888+
),
889+
)
879890
parser.add_argument(
880891
"--ledger-pool-name",
881892
type=str,
@@ -1015,6 +1026,10 @@ def get_settings(self, args: Namespace) -> dict:
10151026
if args.indy_did_contract_address.startswith("0x")
10161027
else f"0x{args.indy_did_contract_address}"
10171028
)
1029+
if args.revocation_list_gas_limit:
1030+
settings["ledger.revocation_list_gas_limit"] = (
1031+
args.revocation_list_gas_limit
1032+
)
10181033
else:
10191034
single_configured = False
10201035
multi_configured = False

aries_cloudagent/ledger/besu_vdr.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ def _send_signed_transaction(
382382
"chainId": chain_id,
383383
"from": self.ledgerConfig.trusteeAccount,
384384
"nonce": nonce,
385+
"gasPrice": self.web3.eth.gas_price,
385386
}
386387
if includeGasInTx:
387388
txParams["gas"] = 3000000

0 commit comments

Comments
 (0)