Use standard ABI encoding instead of the non-standard
packing mode.
This commit is contained in:
parent
b9a9be350a
commit
0fedd8875f
|
@ -94,7 +94,7 @@ contract Contracts {
|
||||||
private pure
|
private pure
|
||||||
returns (bytes32)
|
returns (bytes32)
|
||||||
{
|
{
|
||||||
return keccak256(abi.encodePacked(
|
return keccak256(abi.encode(
|
||||||
"[dagger.request.v1]",
|
"[dagger.request.v1]",
|
||||||
duration,
|
duration,
|
||||||
size,
|
size,
|
||||||
|
@ -110,7 +110,7 @@ contract Contracts {
|
||||||
private pure
|
private pure
|
||||||
returns (bytes32)
|
returns (bytes32)
|
||||||
{
|
{
|
||||||
return keccak256(abi.encodePacked(
|
return keccak256(abi.encode(
|
||||||
"[dagger.bid.v1]",
|
"[dagger.bid.v1]",
|
||||||
requestHash,
|
requestHash,
|
||||||
expiry,
|
expiry,
|
||||||
|
|
|
@ -4,18 +4,18 @@ function hashRequest({
|
||||||
duration, size, contentHash, proofPeriod, proofTimeout, nonce
|
duration, size, contentHash, proofPeriod, proofTimeout, nonce
|
||||||
}) {
|
}) {
|
||||||
const type = "[dagger.request.v1]"
|
const type = "[dagger.request.v1]"
|
||||||
return ethers.utils.solidityKeccak256(
|
return ethers.utils.keccak256(ethers.utils.defaultAbiCoder.encode(
|
||||||
["string", "uint", "uint", "bytes32", "uint", "uint", "bytes32"],
|
["string", "uint", "uint", "bytes32", "uint", "uint", "bytes32"],
|
||||||
[type, duration, size, contentHash, proofPeriod, proofTimeout, nonce]
|
[type, duration, size, contentHash, proofPeriod, proofTimeout, nonce]
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
function hashBid({requestHash, bidExpiry, price}) {
|
function hashBid({requestHash, bidExpiry, price}) {
|
||||||
const type = "[dagger.bid.v1]"
|
const type = "[dagger.bid.v1]"
|
||||||
return ethers.utils.solidityKeccak256(
|
return ethers.utils.keccak256(ethers.utils.defaultAbiCoder.encode(
|
||||||
["string", "bytes32", "uint", "uint"],
|
["string", "bytes32", "uint", "uint"],
|
||||||
[type, requestHash, bidExpiry, price]
|
[type, requestHash, bidExpiry, price]
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sign(signer, hash) {
|
async function sign(signer, hash) {
|
||||||
|
|
Loading…
Reference in New Issue