-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes: #1030 > `needsNonInvokerSigningBy()`'s `filter()` condition returns authorization entires whose address.signature value is `scvVoid`. In my case, this address was a contract. I was trying to figure out how to sign a transaction that used custom auth. > > However, the returned list is then mapped through a function that assumes all addresses are stellar account public keys. This lead to a `TypeError: accountId not set` error. > > **To Reproduce** > > Use the following transaction to construct an `AssembledTransaction` and call `needsNonInvokerSigningBy()`: > > ``` > AAAAAgAAAADhY+75HJcYjxA07MhDzZk/DwQzVITe9slCwDgcEGcc+AACfJ8AEJEBAAAAAwAAAAEAAAAAAAAAAAAAAABmv+l8AAAAAAAAAAEAAAAAAAAAGAAAAAAAAAABOSACpv7RbyYK4XnWgj9AJ/GjrIPjLEoWJa/Iqo1a//YAAAAEbWludAAAAAIAAAASAAAAAAAAAADhY+75HJcYjxA07MhDzZk/DwQzVITe9slCwDgcEGcc+AAAAAoAAAAAAAAAAAAAAAAAAABkAAAAAQAAAAEAAAABEGJ2U3ldj9dca1n1NK0i2XkfL/5zXZsxAOIxUmn9RWknYhAjSWxRgQAAAAAAAAABAAAAAAAAAAE5IAKm/tFvJgrhedaCP0An8aOsg+MsShYlr8iqjVr/9gAAAARtaW50AAAAAgAAABIAAAAAAAAAAOFj7vkclxiPEDTsyEPNmT8PBDNUhN72yULAOBwQZxz4AAAACgAAAAAAAAAAAAAAAAAAAGQAAAAAAAAAAQAAAAAAAAAEAAAAAAAAAAAagL+zRaDmKTHWcB67aFNUZNLVg6ojcyrbO1u3Sg/KcAAAAAYAAAABOSACpv7RbyYK4XnWgj9AJ/GjrIPjLEoWJa/Iqo1a//YAAAAUAAAAAQAAAAYAAAABwfs5RVshthImbX+wmqWS0t1AjL4y5EjMMtSk/oEy11AAAAAUAAAAAQAAAAeheXOfVamUQyN7XuqlXPfXnmxx6tJxnGFVIA2YxmGnMwAAAAIAAAABAAAAAOFj7vkclxiPEDTsyEPNmT8PBDNUhN72yULAOBwQZxz4AAAAAlRFU1Q0AAAAAAAAAAAAAAAagL+zRaDmKTHWcB67aFNUZNLVg6ojcyrbO1u3Sg/KcAAAAAYAAAABEGJ2U3ldj9dca1n1NK0i2XkfL/5zXZsxAOIxUmn9RWkAAAAVJ2IQI0lsUYEAAAAAABUmowAADXgAAADEAAAAAAACfDsAAAAA > ``` > > **Expected behavior** > > The function should not assume all auth entries addresses are stellar accounts -- it should also support contract addresses. also: - switch to new test cases from AhaLabs/soroban-test-contracts - switch to `stellar` instead of `soroban` - use latest cli version - this version fixes a problem that some of the tests were working around, so they were removed
- Loading branch information
Showing
15 changed files
with
152 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
SOROBAN_NETWORK_PASSPHRASE="Standalone Network ; February 2017" | ||
SOROBAN_RPC_URL="http://localhost:8000/soroban/rpc" | ||
SOROBAN_ACCOUNT="me" | ||
STELLAR_NETWORK_PASSPHRASE="Standalone Network ; February 2017" | ||
STELLAR_RPC_URL="http://localhost:8000/soroban/rpc" | ||
STELLAR_ACCOUNT="me" | ||
FRIENDBOT_URL="http://localhost:8000/friendbot" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const { expect } = require("chai"); | ||
const { clientFor } = require("./util"); | ||
|
||
before(async function () { | ||
const { contractId: signingContractId, keypair } = | ||
await clientFor("doesSigning"); | ||
const { client: needsSignature } = await clientFor("needsSignature", { | ||
keypair, | ||
}); | ||
|
||
const tx = await needsSignature.hello({ | ||
to: keypair.publicKey(), | ||
sign_with: signingContractId, | ||
}); | ||
this.context = { tx, signingContractId }; | ||
}); | ||
|
||
describe("needsNonInvokerSigningBy", function () { | ||
it("does not assume stellar accounts", async function () { | ||
expect(this.context.tx.needsNonInvokerSigningBy()[0]).to.equal( | ||
this.context.signingContractId, | ||
); | ||
}); | ||
}); | ||
|
||
describe("sign", function () { | ||
it("doesn't throw error when nonInvokerSigningBy returns a contract", async function () { | ||
expect( | ||
async () => await this.context.tx.sign({ force: true }), | ||
).to.not.throw(); | ||
}); | ||
}); |
Oops, something went wrong.