Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
phearnot committed Sep 19, 2024
1 parent e250b3e commit c79c2bb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
9 changes: 9 additions & 0 deletions docker/docker-compose-geth.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
services:
geth-init:
extends:
file: ./services/geth.yml
service: geth-init

geth:
extends:
file: ./services/geth.yml
service: geth
depends_on:
geth-init:
condition: service_completed_successfully

waves-node:
extends:
file: ./services/waves-node.yml
Expand Down
9 changes: 9 additions & 0 deletions docker/services/geth.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
services:
geth-init:
container_name: geth-init
image: ethereum/client-go:stable
entrypoint: /tmp/init-geth.sh
volumes:
- ../genesis-${NETWORK}.json:/tmp/genesis.json
- ../data/geth:/root/.ethereum
- ../init-geth.sh:/tmp/init-geth.sh
geth:
container_name: geth
image: ethereum/client-go:stable
Expand Down Expand Up @@ -34,6 +42,7 @@ services:
ports:
- '30303:30303/tcp'
- '30303:30303/udp'
- '8551:8551'
healthcheck:
test: 'wget -qO /dev/null --header "content-type: application/json" --post-data {\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":1} http://127.0.0.1:8545'
interval: 5s
Expand Down
13 changes: 8 additions & 5 deletions src/test/resources/main.ride
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ func appendBlock(
}

@Callable(i)
func join(rewardAddress: ByteVector) = {
func join(rewardAddressHex: String) = {
# EL miner must sign a Network block by own private key
func ensureNotOverrideOtherMinerPk(elAddressHex: String) = {
match getBinary(minerPkKey(elAddressHex)) {
Expand All @@ -500,6 +500,9 @@ func join(rewardAddress: ByteVector) = {
}
}

let parts = rewardAddressHex.split("0x")
let rewardAddress = parts[parts.size() - 1].fromBase16String()

if (!isContractSetup()) then
throw("The contract has not yet set up")
else if (i.originCaller.wavesBalance().generating < MIN_BALANCE) then
Expand All @@ -513,8 +516,8 @@ func join(rewardAddress: ByteVector) = {
then []
else {
let newMiner = i.originCaller.toString()
let rewardAddressHex = rewardAddress.toBase16String()
strict check = ensureNotOverrideOtherMinerPk(rewardAddressHex)
let lowercaseRewardAddress = rewardAddress.toBase16String()
strict check = ensureNotOverrideOtherMinerPk(lowercaseRewardAddress)

let newMiners =
if (allMiners.size() == 0)
Expand All @@ -531,8 +534,8 @@ func join(rewardAddress: ByteVector) = {
}
[
StringEntry(allMinersKey, newMiners),
StringEntry(minerRewardAddressKey(newMiner), "0x" + rewardAddressHex),
BinaryEntry(minerPkKey(rewardAddressHex), i.originCallerPublicKey)
StringEntry(minerRewardAddressKey(newMiner), "0x" + lowercaseRewardAddress),
BinaryEntry(minerPkKey(lowercaseRewardAddress), i.originCallerPublicKey)
] ++ deletePrevRewardAddressPk
}
}
Expand Down

0 comments on commit c79c2bb

Please sign in to comment.