Skip to content

Feature/2026 03 07 vottun bridge#786

Open
sergimima wants to merge 61 commits intoqubic:developfrom
sergimima:feature/2025-08-01-VottunBridge
Open

Feature/2026 03 07 vottun bridge#786
sergimima wants to merge 61 commits intoqubic:developfrom
sergimima:feature/2025-08-01-VottunBridge

Conversation

@sergimima
Copy link
Contributor

QubicBridge

Qubic proposal:
https://github.com/sergimima/qubic-proposal/

Contract compliance check PASSED

sergimima and others added 30 commits August 1, 2025 17:40
- Implement bidirectional bridge between Qubic and Ethereum
- Add 27 comprehensive tests covering core functionality
- Support for order management, admin functions, and fee handling
- Include input validation and error handling
- Ready for deployment and IPO process
… division operators

- Remove duplicate and Spanish comments from VottunBridge.h
- Clean up 'NEW'/'NUEVA' comments throughout the code
- Optimize isAdmin and isManager functions (remove unnecessary locals structs)
- Replace division operators with div() function for fee calculations
- Add build artifacts to .gitignore
- Fix syntax errors and improve code consistency
…d clean up build artifacts

- Remove empty getAdminID_locals struct and use PUBLIC_FUNCTION macro
- Remove versioned build/test artifacts from repository
- Clean up remaining comments and code optimizations
- Fix division operators to use div() function consistently
- Refactor isManager to use PRIVATE_FUNCTION_WITH_LOCALS
- Move loop variable 'i' to isManager_locals struct
- Comply with Qubic rule: no local variables allowed in functions
- Address Franziska's feedback on loop variable requirements
- Add tokensReceived and tokensLocked flags to BridgeOrder struct
- Update transferToContract to accept orderId and set per-order flags
- Modify refundOrder to check tokensReceived/tokensLocked before refund
- Update completeOrder to verify token flags for consistency
- Add comprehensive security tests validating the fix
- Prevent exploit where users could refund tokens they never deposited

Tests added:
- SecurityRefundValidation: Validates new token tracking flags
- ExploitPreventionTest: Confirms original vulnerability is blocked
- TransferFlowValidation: Tests complete transfer flow security
- StateConsistencyTests: Verifies state counter consistency

All 24 tests pass successfully.
- Update TEST_F declarations to use braces on new lines
- Fix struct declarations formatting
- Fix if statement brace formatting
- Comply with project code style guidelines
- Remove all 'NEW' comments from functions and procedures
- Fix char literal '\0' to numeric 0 in EthBridgeLogger
- Keep underscore variables (_tradeFeeBillionths, _earnedFees, etc.) as they follow Qubic standard pattern
- All opening braces { are now on new lines per Qubic style guidelines
…e types. Implement setProposalById and cancelProposal methods in the testing framework. Update test cases to validate proposal management and token refund mechanisms. Adjust project configuration to include necessary directories for testing.
…underflow protection. Introduce separate variables for operator and network fees, ensuring only available fees are refunded. Update available fees calculations in multiple functions for consistency and safety.
…plicate admins and managers during proposal processing. Update logic to ensure that existing addresses are not replaced or added again, maintaining the integrity of the admin and manager lists.
…dicated slot index for storing new proposals. This change improves clarity and ensures the correct slot is used when setting proposals, enhancing overall contract functionality.
…r limit. Implement checks to prevent adding more than three managers during proposal processing, enhancing contract security and integrity.
… orders. Implement logic to reserve and release fees for completed orders and refunds, enhancing fee management and underflow protection.
…cesses. Introduce minimum order amount validation to prevent zero-fee spam, enhance fee management with invocation rewards, and implement single-pass recycling for order and proposal slots. Add new refund functionality and corresponding tests to ensure proper fee handling and order status updates.
…act to enhance clarity and maintainability. Adjust admin addresses to reflect new configurations while ensuring proper initialization of state variables.
@fnordspace
Copy link
Contributor

At the moment it looks like you touch some files that should not be touched! For example, private_settings.h, packages.conf. Also it looks like you still have the testnet setup active. Please only commit the relevant files for the contract and without the testnet commit.

…ngs, peers, qubic.cpp, packages.config, gitignore; remove cli.md and tests.md

Made-with: Cursor
@sergimima sergimima force-pushed the feature/2025-08-01-VottunBridge branch from 93fe600 to a9346dd Compare March 10, 2026 14:05
Copy link
Contributor Author

@sergimima sergimima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all good now?

Copy link
Contributor

@fnordspace fnordspace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few little things are left. Also a merge with the latest develop branch is needed. Please do not force push anymore but merge so that we can track the open issues.

The develop branch introduces a change to how contract define state variables. I'll write Arcos in Discord with some information about what changes are needed.

REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(QBOND);
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(QIP);
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(QRAFFLE);
REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES(VOTTUNBRIDGE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to the end of the REGISTER_CONTRACT_FUNCTIONS_AND_PROCEDURES right befor the test contracts

#ifndef NO_PULSE
{"PULSE", 204, 10000, sizeof(PULSE)}, // proposal in epoch 202, IPO in 203, construction and first use in 204
#endif
{"VOTTUN", 199, 10000, sizeof(VOTTUNBRIDGE)}, // proposal in epoch 197, IPO in 200, construction and first use in 197
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update to correct epochs.

}
else if (locals.proposal.proposalType == PROPOSAL_WITHDRAW_FEES)
{
locals.availableFees = (state._earnedFees > (state._distributedFees + state._reservedFees))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fees are always drained in END_TICK() hence this might never run.

{
uint8 status; // Operation status (0 = success, other = error)
uint64 orderId; // ID of the found order
id qubicDestination; // Destination address on Qubic (for EVM to Qubic orders)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is never set in the function, is that on purpose?

@sergimima
Copy link
Contributor Author

sergimima commented Mar 10, 2026 via email

Copy link
Contributor

@fnordspace fnordspace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently not compiling. See #endif issue below.
Besides that only two little things left.

Copy link
Contributor

@fnordspace fnordspace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All tests pass. Ready to go from my side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants