Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ services:
FETCHMNEMONIC: "nut grocery slice visit barrel peanut tumble patch slim logic install evidence fiction shield rich brown around arrest fresh position animal butter forget cost"
ports:
- "26657:26657"
- "9090:9090"
- "1317:1317"

volumes:
Expand Down
6 changes: 3 additions & 3 deletions ethereum/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ verify_ssl = true
[dev-packages]

[packages]
eth-brownie = "==1.13.1"
dataclasses_json = "==v0.5.2"
eth-brownie = "==1.21.0"
dataclasses_json = "==v0.6.7"

[requires]
python_version = "3.8"
python_version = "3.12"
2,609 changes: 2,091 additions & 518 deletions ethereum/Pipfile.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ethereum/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8
FROM python:3.12

RUN pip install pipenv

Expand Down
10 changes: 5 additions & 5 deletions ethereum/scripts/deployment_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
Address = str

AdminRole: bytes = (0).to_bytes(32, byteorder='big')
RelayerRole: bytes = web3.solidityKeccak(['string'], ["RELAYER_ROLE"])
MonitorRole: bytes = web3.solidityKeccak(['string'], ["MONITOR_ROLE"])
ApproverRole: bytes = web3.solidityKeccak(['string'], ["APPROVER_ROLE"])
RelayerRole: bytes = web3.solidity_keccak(['string'], ["RELAYER_ROLE"])
MonitorRole: bytes = web3.solidity_keccak(['string'], ["MONITOR_ROLE"])
ApproverRole: bytes = web3.solidity_keccak(['string'], ["APPROVER_ROLE"])


def get_owner_account(
Expand Down Expand Up @@ -109,7 +109,7 @@ def save_network_manifest(
def configure_bridge_contract(contract: Bridge, owner: Account, contract_manifest: BridgeParams):
def grantRole(role: bytes, wallet: ManifestAccount) -> Address:
address = wallet.address if wallet else None
address = address if web3.isAddress(address) else None
address = address if web3.is_address(address) else None

if address:
contract.grantRole(role, address, {'from': owner})
Expand All @@ -132,7 +132,7 @@ def fund_wallet(wallet: ManifestAccount, wallet_name):
necessary_amount = 0

if wallet and wallet.funding:
wallet_orig_eth_balance = web3.eth.getBalance(wallet.address)
wallet_orig_eth_balance = web3.eth.get_balance(wallet.address)
if wallet_orig_eth_balance < wallet.funding:
necessary_amount = wallet.funding - wallet_orig_eth_balance
owner.transfer(wallet.address, necessary_amount)
Expand Down
14 changes: 7 additions & 7 deletions ethereum/tests/bridge_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ class UsersSetup:
notApprovers: List[Account] = None

def __post_init__(self):
self.relayerRole = brownie.web3.solidityKeccak(['string'], ["RELAYER_ROLE"])
self.approverRole = brownie.web3.solidityKeccak(['string'], ["APPROVER_ROLE"])
self.monitorRole = brownie.web3.solidityKeccak(['string'], ["MONITOR_ROLE"])
self.relayerRole = brownie.web3.solidity_keccak(['string'], ["RELAYER_ROLE"])
self.approverRole = brownie.web3.solidity_keccak(['string'], ["APPROVER_ROLE"])
self.monitorRole = brownie.web3.solidity_keccak(['string'], ["MONITOR_ROLE"])

@classmethod
def default(cls, accounts: Accounts):
Expand Down Expand Up @@ -173,8 +173,8 @@ def default(cls, bridge: BridgeSetup):
return ValuesSetup(
amount=bridge.swapMin,
dest_swap_address=dest_swap_address,
dest_swap_address_hash=brownie.web3.solidityKeccak(["string"], [dest_swap_address]),
src_tx_hash=brownie.web3.solidityKeccak(["string"], ["some tx has"])
dest_swap_address_hash=brownie.web3.solidity_keccak(["string"], [dest_swap_address]),
src_tx_hash=brownie.web3.solidity_keccak(["string"], ["some tx has"])
)


Expand Down Expand Up @@ -279,7 +279,7 @@ def swap(self, user, amount: int = None, dest_addr: str = None):
event = tx.events[str(EventType.Swap)]
assert event['id'] == origSwapId
assert event['from'] == user
assert brownie.convert.to_bytes(event['indexedTo'], 'bytes32') == brownie.web3.solidityKeccak(['string'], [dest_addr])
assert brownie.convert.to_bytes(event['indexedTo'], 'bytes32') == brownie.web3.solidity_keccak(['string'], [dest_addr])
assert event['to'] == dest_addr
assert event['amount'] == amount

Expand Down Expand Up @@ -363,7 +363,7 @@ def reverseSwap(self,
event = tx.events[str(EventType.ReverseSwap)]
assert event['rid'] == rid
assert event['to'] == to_user
assert brownie.convert.to_bytes(event['from'], 'bytes32') == brownie.web3.solidityKeccak(['string'], [origin_from])
assert brownie.convert.to_bytes(event['from'], 'bytes32') == brownie.web3.solidity_keccak(['string'], [origin_from])
assert brownie.convert.to_bytes(event['originTxHash'], 'bytes32') == origin_tx_hash
assert event['effectiveAmount'] == effective_amount
assert event['fee'] == effective_fee
Expand Down
6 changes: 3 additions & 3 deletions fetch/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04 as base
FROM ubuntu:24.04 as base

USER root

Expand All @@ -14,7 +14,7 @@ RUN apt install -y gcc curl jq
RUN curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf >rustup.rs && bash rustup.rs -y

ENV PATH="$PATH:/root/.cargo/bin"
RUN echo $PATH && ls $HOME && rustup default stable && cargo version && \
RUN echo $PATH && ls $HOME && rustup default 1.69.0 && cargo version && \
rustup update stable

RUN rustup target add wasm32-unknown-unknown
Expand All @@ -26,4 +26,4 @@ WORKDIR ${CONTRACT_MOUNT}
COPY ./scripts /scripts

ENTRYPOINT ["/scripts/compile.sh"]
CMD ["/contract"] #FIXME(LR) use ARG var
CMD ["/contract"] #FIXME(LR) use ARG var
2 changes: 1 addition & 1 deletion fetch/ledger/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM fetchai/fetchd:0.8.7
FROM fetchai/fetchd:0.14.1

COPY run-node.sh /usr/bin/run-node.sh

Expand Down
6 changes: 3 additions & 3 deletions fetch/ledger/contractdeploy.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM fetchai/fetchd:0.8.7
FROM fetchai/fetchd:0.14.1

USER root

Expand All @@ -16,7 +16,7 @@ RUN apt update && \
RUN curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf >rustup.rs && bash rustup.rs -y

ENV PATH="$PATH:/root/.cargo/bin"
RUN echo $PATH && ls $HOME && rustup default stable && cargo version && \
RUN echo $PATH && ls $HOME && rustup default 1.69.0 && cargo version && \
rustup update stable


Expand All @@ -27,4 +27,4 @@ RUN echo $PATH && ls $HOME && rustup default stable && cargo version && \
RUN rustup target add wasm32-unknown-unknown


COPY . .
COPY . .
22 changes: 12 additions & 10 deletions fetch/scripts/compile.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#!/bin/bash
#!/bin/sh

set -e
set -xe

wd=$(pwd)
cd $1
RUSTFLAGS='-C link-arg=-s' cargo wasm
cp target/wasm32-unknown-unknown/release/*.wasm $wd

if [[ $* == *--test* ]];
then
cargo test --lib
fi
optimize.sh .

rm target/ -rf
cp artifacts/* $wd

case "$*" in
*--test*)
cargo test --lib
;;
esac

rm -rf registry_cache contract_cache artifacts target
Loading