Skip to content

Commit

Permalink
fix: public input hash incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
Westlad committed Jan 12, 2022
1 parent 781e89c commit 4b4ad95
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 38 deletions.
8 changes: 1 addition & 7 deletions common-files/classes/public-inputs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@ class PublicInputs {

constructor(publicInputs) {
// some inputs may be general numbers and some strings. We convert all to string, process and generalise.
this.publicInputs = generalise(
generalise(publicInputs.flat(Infinity))
.all.hex()
.map(pi => pi.toLowerCase()),
);
console.log('PUBLIC INPUTS', this.publicInputs);
this.publicInputs = generalise(publicInputs.flat(Infinity));
[, this.hash] = generalise(sha256(this.publicInputs).limbs(248, 2));
console.log('HASH', this.hash);
}
}

Expand Down
2 changes: 1 addition & 1 deletion nightfall-client/src/services/database.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function getLatestTree() {
const timberObjArr = await db
.collection(TIMBER_COLLECTION)
.find()
.sort({ _id: -1 })
.sort({ blockNumberL2: -1 })
.limit(1)
.toArray();

Expand Down
6 changes: 6 additions & 0 deletions nightfall-client/src/services/transfer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ async function transfer(transferParams) {
const leafIndices = commitmentTreeInfo.map(l => l.leafIndex);
const blockNumberL2s = commitmentTreeInfo.map(l => l.isOnChain);
const roots = commitmentTreeInfo.map(l => l.root);
console.log(
'Constructing transfer transaction with blockNumberL2s',
blockNumberL2s,
'and roots',
roots,
);

// public inputs
const publicInputs = new PublicInputs([
Expand Down
26 changes: 13 additions & 13 deletions test/ping-pong/docker-compose.host.docker.internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ services:
ZKP_MNEMONIC: tone shadow woman critic glare utility brass scheme edge brisk enforce champion


user-local2:
extra_hosts:
- 'host.docker.internal:host-gateway'
environment:
BLOCKCHAIN_WS_HOST: host.docker.internal
BLOCKCHAIN_PORT: 8546
USER_ETHEREUM_SIGNING_KEY: eed50965cbe8268a3ee0a24afc2f31c434a7d568bdff73a89783711c91ca1c67
USER_ADDRESS: '0x4637Ee1126723e098A152f33F326fb767A6A2b8A'
TEST_LENGTH: 24
ERC20_NAME: ERC20Mock
RECIPIENT_PKD: 0x193a37cd7973373aceae05d133f3d69ab6e7ef2f4321461173871ec7611244e2,0x27234a8721e73c9aa160154ee63d2470101fc5fd841221eeb675a91ec2d66e78
ZKP_MNEMONIC:
tiger victory velvet tank ritual column horse conduct athlete position soul shaft
# user-local2:
# extra_hosts:
# - 'host.docker.internal:host-gateway'
# environment:
# BLOCKCHAIN_WS_HOST: host.docker.internal
# BLOCKCHAIN_PORT: 8546
# USER_ETHEREUM_SIGNING_KEY: eed50965cbe8268a3ee0a24afc2f31c434a7d568bdff73a89783711c91ca1c67
# USER_ADDRESS: '0x4637Ee1126723e098A152f33F326fb767A6A2b8A'
# TEST_LENGTH: 24
# ERC20_NAME: ERC20Mock
# RECIPIENT_PKD: 0x193a37cd7973373aceae05d133f3d69ab6e7ef2f4321461173871ec7611244e2,0x27234a8721e73c9aa160154ee63d2470101fc5fd841221eeb675a91ec2d66e78
# ZKP_MNEMONIC:
# tiger victory velvet tank ritual column horse conduct athlete position soul shaft
30 changes: 15 additions & 15 deletions test/ping-pong/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,21 @@ services:
BLOCKCHAIN_WS_HOST: blockchain1
BLOCKCHAIN_PORT: 8546

user-local2:
image: ghcr.io/eyblockchain/nightfall3-user-local:latest
build:
dockerfile: user-local.Dockerfile
context: ../../
networks:
- pong_network
environment:
OPTIMIST_HOST: optimist
OPTIMIST_WS_PORT: 8080
OPTIMIST_HTTP_PORT: 80
CLIENT_HOST: client
CLIENT_PORT: 80
BLOCKCHAIN_WS_HOST: blockchain1
BLOCKCHAIN_PORT: 8546
# user-local2:
# image: ghcr.io/eyblockchain/nightfall3-user-local:latest
# build:
# dockerfile: user-local.Dockerfile
# context: ../../
# networks:
# - pong_network
# environment:
# OPTIMIST_HOST: optimist
# OPTIMIST_WS_PORT: 8080
# OPTIMIST_HTTP_PORT: 80
# CLIENT_HOST: client
# CLIENT_PORT: 80
# BLOCKCHAIN_WS_HOST: blockchain1
# BLOCKCHAIN_PORT: 8546

volumes:
mongodb:
Expand Down
4 changes: 2 additions & 2 deletions test/ping-pong/pong-apps
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ done
# shut down cleanly in the event of a cntl-c etc. We don't want to leave containers running
trap "exit 1" SIGHUP SIGINT SIGTERM

docker-compose -f docker-compose.yml $FILE up -d --remove-orphans proposer user-local1 user-local2
docker-compose logs -f proposer user-local1 user-local2
docker-compose -f docker-compose.yml $FILE up -d --remove-orphans proposer user-local1 #user-local2
docker-compose logs -f proposer user-local1 #user-local2

0 comments on commit 4b4ad95

Please sign in to comment.