Repository navigation
updated CI to use a stable toolchain - #1
Merged
Merged
Conversation
This was referenced Jun 20, 2026
5 tasks
nanaf6203-bit
added a commit
to nanaf6203-bit/bridgelet-core
that referenced
this pull request
Jul 24, 2026
…tests, accurate reentrancy doc Closes bridgelet-org#239 Closes bridgelet-org#240 Closes bridgelet-org#241 Closes bridgelet-org#242 Addressing the four open issues assigned to @nanaf6203-bit: bridgelet-org#240 (CRITICAL) account_factory::initialize had no auth and no already-initialized guard. New initialize(env, creator, wasm_hash) -> Result<(), Error>; storage-state check runs first, then creator.require_auth(), then writes the hash and seeds BatchNonce = 0. New contracts/account_factory/src/errors.rs with Error enum (AlreadyInitialized = 1, NotInitialized = 2). Double-init now panics with Error(Contract, bridgelet-org#1) so the WASM hash can no longer be silently overwritten. This is a deliberate breaking change to initialize's signature: account_factory is described in the project README as entirely undocumented and undeployed, and has no init invocation in scripts/deploy-testnet.sh or in CI, so the new signature is safe to ship. bridgelet-org#241 (CRITICAL) batch_initialize deployment salt collided across calls. Soroban derives a contract address from (factory_address, salt, wasm_hash), so a salt that depended only on the per-batch index would collide on the second call (the loop would again produce salt = [0...0 || index]). DataKey::BatchNonce (u64) is bumped once per batch_initialize invocation. Salt layout (BE, 32 bytes): [0..8] nonce monotonic u64 [8..28] zeros reserved (forward compatibility) [28..32] index per-request position inside the call Guarantees: distinct calls yield disjoint address ranges even at the same index; deterministic given (factory, nonce, index, wasm_hash). bridgelet-org#242 (HIGH) account_factory's only test did not call batch_initialize and did not assert anything. Replaced with seven real tests covering both bridgelet-org#240 and bridgelet-org#241: Result variant on double-init, front-running scenario, missing-auth abort, should_panic(Error(Contract, bridgelet-org#1)), 3-request happy path with Active status per deployed account plus intra-batch uniqueness, cross-call salt uniqueness at the same index, monotonic nonce across 5 invocations. Tests pull the real wasm hash via env.deployer().upload_contract_wasm( include_bytes!("../../../target/wasm32v1-none/release/ephemeral_account.wasm")) and use env.register(EphemeralAccountContract, ()) for direct SDK calls. bridgelet-org#239 (MEDIUM) docs/reentrancy-analysis.md overstated record_payment coverage. Added an indirect AlreadySwept row to the summary table; rewrote the closing sentence to accurately state: record_payment is not reentrancy-locked (no AccountStatus read, no require_auth, accepts any caller); the only reentrancy-style defense for the record_payment-then-sweep pattern is the AlreadySwept guard inside the second sweep() call. Callers must authenticate record_payment calls out-of-band; the contract does not enforce it.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.