Skip to content
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

ABI dir fixes #2003

Merged
merged 37 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9090183
beamer: move load_rpc_info from beamer.deploy.config to beamer.util
Jun 28, 2023
ff393cd
beamer: tests: config: add missing --abi-dir option
Jun 30, 2023
6560468
beamer: move get_commit_id from beamer.deploy.util to beamer.util
Jun 30, 2023
030e906
beamer: deploy: move artifacts generation to util
Jun 30, 2023
9da442a
beamer: contract: add obtain_contract
Jun 30, 2023
7ec1dbb
beamer: deploy: add missing --abi-dir options
Jun 30, 2023
2f48315
beamer: config: convert to use beamer.contract.obtain_contract
Jun 30, 2023
2428f1a
scripts: e2e-test-op-commands: convert to use beamer.contracts.obtain…
Jun 30, 2023
e8ed37b
docker: optimism: add missing --abi-dir option
Jun 30, 2023
b9a8ae8
scripts: e2e-test-op-commands: make the function name consistent with…
Jun 30, 2023
bb75980
beamer: deploy: remove artifacts.obtain_contract
Jun 30, 2023
053ee63
beamer: deploy: remove util.make_contract
Jun 30, 2023
26d0774
beamer: move deploy.artifacts one level up
Jun 30, 2023
2b76f1a
beamer: contracts: introduce ABIManager
Jul 6, 2023
ec02cde
beamer: deploy: use ABIManager
Jul 6, 2023
86b071b
beamer: deploy: remove unused code
Jul 6, 2023
2e194c4
beamer: deploy: silence pylint
Jul 6, 2023
19b7cb6
beamer: contracts: require an ABIManager in obtain_contract
Jul 6, 2023
9508f2c
beamer: provide an ABIManager instance to obtain_contract instead of …
Jul 6, 2023
01ef1e4
beamer: artifacts: add a helper load_all function
Jul 6, 2023
65ad190
beamer: artifacts: add a helper property, Deployment.earliest_block
Jul 6, 2023
7a3bff7
beamer: health: move to use the new ABIManager and artifacts facilities
Jul 6, 2023
04c5938
beamer: tests: move the 'root' variable into _generate_deployment_dir
Jul 6, 2023
6dd0433
beamer: tests: split _generate_deployment_dir into two and make it av…
Jul 6, 2023
63066e8
beamer: agent: don't load artifacts as part of config setup
Jul 6, 2023
3b3dea4
beamer: tests: name artifacts properly when generating them
Jul 7, 2023
78a8c0d
beamer: tests: make tests work again after the config changes
Jul 7, 2023
15fdd1c
beamer: contracts: switch contracts_for_web3 to use new API internally
Jul 7, 2023
86ff05b
beamer: contracts: remove unused code
Jul 7, 2023
2e0475b
docker: scripts: fix deploy-base and deploy invocation
Jul 7, 2023
8eb045a
beamer: artifacts: add a new helper function to load only a single de…
Jul 11, 2023
ff22dc7
scripts: move away from using contracts_for_web3
Jul 11, 2023
11a5da6
beamer: contracts: remove the now unused contracts_for_web3
Jul 11, 2023
695c356
beamer: agent: use beamer.artifacts.load instead of load_all
Jul 11, 2023
c614b55
beamer: health: use beamer.artifacts.load instead of load_all
Jul 11, 2023
1c16f81
beamer: artifacts: remove the now unused load_all function
Jul 11, 2023
8013248
beamer: tests: config: don't hardcode chain ID
Jul 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions scripts/call_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from web3.constants import ADDRESS_ZERO
from web3.contract import Contract

from beamer.contracts import contracts_for_web3
import beamer.artifacts
from beamer.contracts import ABIManager, obtain_contract
from beamer.typing import URL, Address, ChainId, TokenAmount
from beamer.util import account_from_keyfile, make_web3, setup_logging, transact
from scripts._util import pass_args, validate_address, validate_bytes
Expand Down Expand Up @@ -51,7 +52,13 @@ def cli(

account = account_from_keyfile(keystore_file, password)
web3 = make_web3(eth_rpc, account)
contracts = contracts_for_web3(web3, artifacts_dir, abi_dir)

abi_manager = ABIManager(abi_dir)
deployment = beamer.artifacts.load(artifacts_dir, ChainId(web3.eth.chain_id))

contracts = {}
for name in ("RequestManager", "FillManager", "MintableToken"):
istankovic marked this conversation as resolved.
Show resolved Hide resolved
contracts[name] = obtain_contract(web3, abi_manager, deployment, name)

ctx.ensure_object(dict)
ctx.obj["web3"] = web3
Expand Down
11 changes: 7 additions & 4 deletions scripts/e2e-test-fill.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import sys
from pathlib import Path

from beamer.contracts import contracts_for_web3
import beamer.artifacts
from beamer.contracts import ABIManager, obtain_contract
from beamer.tests.util import create_request_id
from beamer.typing import URL, ChainId
from beamer.util import account_from_keyfile, make_web3
Expand All @@ -20,15 +21,17 @@ def main() -> None:
deployer = account_from_keyfile(keystore_file, password)
web3 = make_web3(l2_rpc, deployer)

l2_contracts = contracts_for_web3(web3, artifacts_dir, abi_dir)
abi_manager = ABIManager(abi_dir)
deployment = beamer.artifacts.load(artifacts_dir, ChainId(web3.eth.chain_id))

overriden_chain_id = os.getenv("SOURCE_CHAIN_ID")
if overriden_chain_id is None:
source_chain_id = ChainId(web3.eth.chain_id)
else:
source_chain_id = ChainId(int(overriden_chain_id))

fill_manager = l2_contracts["FillManager"]
token = l2_contracts["MintableToken"]
fill_manager = obtain_contract(web3, abi_manager, deployment, "FillManager")
token = obtain_contract(web3, abi_manager, deployment, "MintableToken")

nonce = random.randint(1, sys.maxsize)
request_amount = 123
Expand Down
9 changes: 6 additions & 3 deletions scripts/e2e-test-verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import eth_utils
from web3 import HTTPProvider, Web3

from beamer.contracts import contracts_for_web3
import beamer.artifacts
from beamer.contracts import ABIManager, obtain_contract
from beamer.typing import ChainId


def main() -> None:
Expand All @@ -17,8 +19,9 @@ def main() -> None:
request_id = sys.argv[5]

web3 = Web3(HTTPProvider(l2_rpc))
l2_contracts = contracts_for_web3(web3, artifacts_dir, abi_dir)
request_manager = l2_contracts["RequestManager"]
abi_manager = ABIManager(abi_dir)
deployment = beamer.artifacts.load(artifacts_dir, ChainId(web3.eth.chain_id))
request_manager = obtain_contract(web3, abi_manager, deployment, "RequestManager")

print("Waiting for resolution data...", flush=True, end="")
for _ in range(60):
Expand Down