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
|
||||
returns (bytes32)
|
||||
{
|
||||
return keccak256(abi.encodePacked(
|
||||
return keccak256(abi.encode(
|
||||
"[dagger.request.v1]",
|
||||
duration,
|
||||
size,
|
||||
|
@ -110,7 +110,7 @@ contract Contracts {
|
|||
private pure
|
||||
returns (bytes32)
|
||||
{
|
||||
return keccak256(abi.encodePacked(
|
||||
return keccak256(abi.encode(
|
||||
"[dagger.bid.v1]",
|
||||
requestHash,
|
||||
expiry,
|
||||
|
|
|
@ -4,18 +4,18 @@ function hashRequest({
|
|||
duration, size, contentHash, proofPeriod, proofTimeout, nonce
|
||||
}) {
|
||||
const type = "[dagger.request.v1]"
|
||||
return ethers.utils.solidityKeccak256(
|
||||
return ethers.utils.keccak256(ethers.utils.defaultAbiCoder.encode(
|
||||
["string", "uint", "uint", "bytes32", "uint", "uint", "bytes32"],
|
||||
[type, duration, size, contentHash, proofPeriod, proofTimeout, nonce]
|
||||
)
|
||||
))
|
||||
}
|
||||
|
||||
function hashBid({requestHash, bidExpiry, price}) {
|
||||
const type = "[dagger.bid.v1]"
|
||||
return ethers.utils.solidityKeccak256(
|
||||
return ethers.utils.keccak256(ethers.utils.defaultAbiCoder.encode(
|
||||
["string", "bytes32", "uint", "uint"],
|
||||
[type, requestHash, bidExpiry, price]
|
||||
)
|
||||
))
|
||||
}
|
||||
|
||||
async function sign(signer, hash) {
|
||||
|
|
Loading…
Reference in New Issue