Near-One / rainbow-bridge

🌈🌈🌈 NEAR <> Ethereum Decentralized Bridge
GNU General Public License v3.0
326 stars 99 forks source link

NEAR2Eth-Relay: Optmized block selection #732

Closed mfornet closed 2 years ago

mfornet commented 2 years ago

Aurora Bounty Terms

Before beginning work on the bounty, you must submit a proposal. Only if your proposal is accepted will you be able to claim the reward of the bounty. Your proposal should include time that it would take for your to complete this bounty.

There should be at most 1 week between proposal is accepted and you start working on the bounty.

Description

Improve NEAR to Ethereum block relayer, such that it selects the block with smaller payload in a range to be submitted to NEAR Light Client on Ethereum.

Context

For bridge health, it is required that NEAR to Ethereum block relayer relays a block at least once per epoch (every 12 hours). In practice this is done every 4 hours to provide better UX. These transactions can be seen in the NEAR Light Client on Ethereum. Most of the cost of the gas is a product of deserializing the block inside the solidity smart contract. While writing this issue the fee paid for submitting the last 4 blocks were 0.099 ETH, 0.064 ETH, 0.057 ETH, 0.136 ETH. As can be seen there is a notable variance in the fee paid, this depends both on the gas price and the size of the payload.

The goal in this task is to query during a fixed period of time NEAR RPC, and get the block with smallest payload. Then submit this block using the new Ethereum Transaction Format introduced in EIP-1559

Relevant repos or issues

Acceptance Criteria

Bounty

500 DAI (It can be paid in Ethereum, NEAR or Aurora blockchain)

mfornet commented 2 years ago

Close in favor of https://github.com/aurora-is-near/bounties/issues/1