baking-bad / pytezos

🐍 Python SDK for Tezos | Michelson VM in Python
https://pytezos.org
MIT License
111 stars 36 forks source link

Reduced `max_operations_ttl` to fix Parisnet Operation Injections #371

Closed igorsereda closed 2 months ago

igorsereda commented 2 months ago

This PR fixes errors like

pytezos.rpc.node.RpcError: ({'id': 'failure',
  'kind': 'temporary',
  'msg': 'Operation ooRp9PH8nTAhdn2zyL5P9FyoFKgdfbV25R8YbnnEYvxxRz3c6vd is '
         'branched on either:\n'
         ' - a block BLM7z6yUZCZMzWEnFzsgRbTzfTev5m35Mf9CCXeBLuJTxu5LGtE which '
         'is too old (121 blocks in the past)\n'
         ' - a predecessor block from an alternative branch which is now '
         'unknown'},)
github-actions[bot] commented 2 months ago

Test Results

1β€ˆ110 tests  Β±0   1β€ˆ098 :white_check_mark: Β±0   1m 45s :stopwatch: -19s β€‡β€ˆβ€‡β€‡4 suites Β±0β€‚β€ƒβ€ƒβ€‡β€ˆβ€‡12 :zzz: Β±0  β€‡β€ˆβ€‡β€‡4 files   Β±0β€‚β€ƒβ€ƒβ€‡β€ˆβ€‡β€‡0 :x: Β±0 

Results for commit ddee28ab. ± Comparison against base commit 85a7ce83.

github-actions[bot] commented 2 months ago

Test Results

1β€ˆ110 tests  Β±0   1β€ˆ098 :white_check_mark: Β±0   2m 5s :stopwatch: -1s β€‡β€ˆβ€‡β€‡4 suites Β±0β€‚β€ƒβ€ƒβ€‡β€ˆβ€‡12 :zzz: Β±0  β€‡β€ˆβ€‡β€‡4 files   Β±0β€‚β€ƒβ€ƒβ€‡β€ˆβ€‡β€‡0 :x: Β±0 

Results for commit ddee28ab. ± Comparison against base commit 85a7ce83.

:recycle: This comment has been updated with latest results.

ztepler commented 2 months ago

I tried to understand what was happening here and why this constant affects transactions at all.

As far as I understand, this MAX_OPERATIONS_TTL is used to calculate the branch here. As far as DEFAULT_OPERATIONS_TTL is 5 the branch will be equal to the head~115 block hash. And then the OperationGroup spawned with this branch, right?

Not sure why this logic is required, why not use more recent blocks?

I suppose this is because before Tenderbake (about two years ago) there was no finality and there was a chance that the chain would be forked, can someone confirm?

Anyway, I checked that this works both in the pariscnet and mainnet, so looks good to me.