-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split NEP-141 logic #607
base: develop
Are you sure you want to change the base?
Split NEP-141 logic #607
Conversation
…o feat/split-eth-connector
…o feat/split-eth-connector
# Conflicts: # Cargo.lock # engine-standalone-storage/src/relayer_db/mod.rs # engine-standalone-storage/src/sync/mod.rs # engine-standalone-storage/src/sync/types.rs # engine-tests/src/tests/eth_connector.rs # engine-tests/src/tests/state_migration.rs # engine-tests/src/tests/xcc.rs # engine-types/src/storage.rs # engine-types/src/types/balance.rs # engine/src/admin_controlled.rs # engine/src/connector.rs # engine/src/lib.rs # engine/src/parameters.rs
engine/src/metadata.rs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
metadata
is a more common name. I would use something more specific for that. E.g. ft_metadata
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it shouldn't even exist. But before removing NEP-141, I think it's more efficient to keep it in Engine because it returns just const
data. If we change it to a cross-contract call, we should attach gas. So really temporary solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove some API but then keep others? It isn't the nETH contract anymore.
Co-authored-by: Oleksandr Anyshchenko <[email protected]>
Co-authored-by: Oleksandr Anyshchenko <[email protected]>
method: "engine_ft_transfer_call".to_string(), | ||
args: data, | ||
attached_balance: Yocto::new(1), | ||
attached_gas: GAS_FOR_FT_TRANSFER_CALL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is unpredictable how much gas the ft_transfer_call cost because it depends on the ft_on_transfer
function. But here we provide the constant gas amount and users don't have the opportunity to increase it.
What about using the trick from the standard realization: https://docs.rs/near-contract-standards/latest/src/near_contract_standards/fungible_token/core_impl.rs.html#146 ?
engine/src/connector.rs
Outdated
method: "ft_metadata".to_string(), | ||
args: Vec::new(), | ||
attached_balance: ZERO_ATTACHED_BALANCE, | ||
attached_gas: GAS_FOR_FINISH_DEPOSIT, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why GAS_FOR_FINISH_DEPOSIT
?
engine/src/connector.rs
Outdated
method: "get_bridge_prover".to_string(), | ||
args: Vec::new(), | ||
attached_balance: ZERO_ATTACHED_BALANCE, | ||
attached_gas: GAS_FOR_FINISH_DEPOSIT, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why GAS_FOR_FINISH_DEPOSIT
?
engine/src/connector.rs
Outdated
method: "get_accounts_counter".to_string(), | ||
args: Vec::new(), | ||
attached_balance: ZERO_ATTACHED_BALANCE, | ||
attached_gas: GAS_FOR_FINISH_DEPOSIT, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why GAS_FOR_FINISH_DEPOSIT
?
# Conflicts: # .github/workflows/tests.yml # Cargo.lock # Cargo.toml # Makefile.toml # engine-standalone-nep141-legacy/src/fungible_token.rs # engine-standalone-storage/Cargo.toml # engine-standalone-storage/src/sync/mod.rs # engine-tests/Cargo.toml # engine-tests/src/tests/erc20_connector.rs # engine-tests/src/tests/eth_connector.rs # engine-tests/src/tests/mod.rs # engine-tests/src/tests/repro.rs # engine-tests/src/tests/sanity.rs # engine-tests/src/tests/state_migration.rs # engine-tests/src/tests/uniswap.rs # engine-tests/src/tests/xcc.rs # engine-tests/src/utils/mod.rs # engine-tests/src/utils/standalone/mocks/mod.rs # engine-types/src/parameters/mod.rs # engine/src/connector.rs # engine/src/lib.rs # engine/src/parameters.rs
fd29e16
to
5b14000
Compare
5b14000
to
d3eec6f
Compare
## Description The PR is a clone of #607 but for SILO smart contract. --------- Co-authored-by: Evgeny Ukhanov <[email protected]> Co-authored-by: Michael Birch <[email protected]>
Split NEP-141
It is based on AIP: Split NEP-141 logic outside of Engine.
The main purpose is to isolate the NEP-141 Fungible Token logic into a separate contract and remove this logic from the Engine.
Aurora Eth Connector contract: https://github.com/aurora-is-near/aurora-eth-connector
Main goals
aurora-eth-connector
contracteth-connector
testsaurora-eth-connector
Solution
fungible_token
moduleaurora-eth-connector
.ft_transfer
ft_transfer_call
ft_total_supply
ft_balance_of
ft_metadata
deposit
withdraw
storage_deposit
storage_unregister
storage_balance_of
ft_on_transfer
is part of Engine, and responsible as call-back function forft_transfer_call
onaurora-eth-connector
connector
moduleengine-tests-connector
, with deploying newaurora-eth-connector
contractengine-tests
all tests related toeth-connector
finish_deposit
and other eth-connector specific functions now are part ofaurora-eth-connector
. This means that now we cannot receive events from there and process them since these functions are private.standalone-legacy-nep141
implementation (Feat: standalone nep141 legacy #669)Gas costs
Not changed.
Breaking changes
The important change is that before the NEP-141 function call was direct, now it is a cross-contract call. This means that in the NEAR blockchain, this challenge is found as a recipe. This means that if the function had previously returned an error, the transaction was rolled back. Now the transaction will be successful if an error occurs in the receipt. This nuance must be taken into account.
CI flow
Github CI flow was changed. In particular, now the current version of
aurora-eth-connector
is downloaded from the remote repository and a contract for tests is being assembled. The run-tests parameters have also been changed, and the number of threads that can be started is limited, which is caused by current restrictionsworkspace.rs
issue 253.