An Enhanced Deep Learning Framework for Smart Contract Vulnerability Detection in Ethereum Blockchain
Abstract
Transformer-based detectors for Solidity smart contracts almost universally encode a contract within a single 512-token window, then attribute performance differences to the choice of pre-trained encoder. We show this attribution is misplaced. On DIVE-25 (22,330 deployed contracts, eight DASP categories, multi-label at 2.46 labels per contract) the median contract occupies 2,994 sub-word tokens and only 5.48% fit a single window. We segment each contract at top-level declaration boundaries, pack the segments greedily into at most 24 chunks of 510 tokens for an effective context of 12,240 tokens covering 98.25% of the corpus, and recombine the chunk representations with a bidirectional LSTM under additive attention. Holding preprocessing, chunk budget, pooling, aggregator, loss, schedule, seeds and split identical, the extended context is worth +0.1038 micro-F1 and +0.1722 macro-F1 over single-window truncation, roughly four times the benefit of the best available encoder. The loss under truncation is markedly uneven: Front Running falls by 0.294 and Time manipulation by 0.262, while Access Control, whose indicators sit near the top of a file, loses 0.010. Fifty-one structural measurements and a five-relation contract graph enter the classifier through per-class gates initialised at Ο(β4) β 0.018, so any contribution must be learned; both open, and the resulting gain is 1.9 times larger on categories below 900 test instances. Under family-aware leakage-controlled partitioning the complete system reaches 0.8435 micro-F1 and0.7775 macro-F1, with the fusion gain significant under a paired bootstrap (macro-F1 +0.0173, 95% CI [+0.0113, +0.0236]). We report every result additionally on a twin-free test subset from which the 39.58% of test contracts sharing a structural twin with training are removed. Finally, evaluated against human-verified exploitability judgements the detector scores 0.455 mean AUC, below a baseline built from contract size and compiler version alone (0.735), bounding what any detector trained on analyser consensus can be claimed to do.
Community
0 commentsNo discussion yet
Be the first to share a question or observation.